<template>
  <el-breadcrumb :separator-icon="ArrowRight">
    <el-breadcrumb-item :to="{ path: '/' }">东软环保监督</el-breadcrumb-item>
    <el-breadcrumb-item v-for="(item, index) in currentitems" :key="'breadcrumb' + index">{{
      item
    }}</el-breadcrumb-item>
  </el-breadcrumb>
</template>

<script setup>
import { ArrowRight } from '@element-plus/icons-vue'
import { useRoute } from 'vue-router'
import { ref, watch } from 'vue'

const currentitems = ref([])

const CrumbItems = {
  about: ['aaaa', 'bbbbb'],
  b: []
}

const route = useRoute()
// const router = useRouter()

watch(
  () => route.name,
  (newPath) => {
    console.log(newPath)
    currentitems.value.length = 0
    currentitems.value = CrumbItems[newPath]
  },
  {
    immediate: true
  }
)
</script>
